package edu.xlh.travel.shiro.domin;


import lombok.Data;
import org.apache.shiro.authc.UsernamePasswordToken;

@Data
public class DiyToken extends UsernamePasswordToken {

    private String phone;
    private String email;
    private char[] password;
    private boolean rememberMe;
    private String host;

    public DiyToken() {
        this.rememberMe = false;
    }

    @Override
    public boolean isRememberMe() {
        return false;
    }

    @Override
    public Object getPrincipal() {
        return this.phone == null ? this.email : this.phone;
    }

    @Override
    public Object getCredentials() {
        return this.getPassword();
    }

    @Override
    public String getHost() {
        return this.host;
    }
}
